package com.ouc.yyi.springbootwebapp.controller;

import com.cebbank.yyi.impl.Impl;
import com.ouc.yyi.springbootwebapp.bo.UserBo;
import com.ouc.yyi.springbootwebapp.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;

/**
 * @name: SpringBootController
 * @author: yyi
 * @time: 2022-07-23 20:01
 * @description:
 */
@RestController
public class SpringBootController {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @Autowired
    private UserInfoService userInfoService;


    @RequestMapping(value = "/index" , method = RequestMethod.GET)
    public String index() {
        //redisTemplate.opsForValue().set("yangyi","nihao");
        //System.err.println(redisTemplate.opsForValue().get("yangyi"));
        return "hello, this is first SpringBoot application";
    }

    /**
     * @description: 添加用户信息
     * @param:
     * @return:
     * @author: yyi
     * @date: 2022/8/29 15:09
     * @version: 1.0
     **/
    @PostMapping("save")
    public int save(@RequestBody UserBo userBo) {
        System.out.println("当前的user信息:" + userBo);
        return userInfoService.saveUser(userBo);
    }
}
